<?php

namespace adibilis\adminBundle\Form;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;


class ArticleType extends AbstractType
{
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->add('title',   'text', array('label' => "Titre de l'article"))
            ->add('titleen',   'text', array('label' => "Titre de l'article (Anglais)"))
            ->add('titlede',   'text', array('label' => "Titre de l'article (Allemand)"))
            ->add('content',      'textarea' , array( 'attr' => array('class' => 'ckeditor'), 'label' => "Contenu de l'article", 'required' => false))
            ->add('contenten',      'textarea' , array( 'attr' => array('class' => 'ckeditor'), 'label' => "Contenu de l'article (Anglais)", 'required' => false))
            ->add('contentde',      'textarea' , array( 'attr' => array('class' => 'ckeditor'), 'label' => "Contenu de l'article (Allemand)", 'required' => false))

            ->add('image',        new ArticleImageType(), array('required' => false)) 
            ->add('author', 'entity', array(
                  'class'    => 'adibilisUserBundle:User',
                  'property' => 'username',
                  'label' => 'Auteur'))
        ;
    }

    public function setDefaultOptions(OptionsResolverInterface $resolver)
    {
        $resolver->setDefaults(array(
            'data_class' => 'adibilis\adminBundle\Entity\Article'
        ));
    }

    public function getName()
    {
        return 'adibilis_adminbundle_articletype';
    }
}
